package com.example.springcloud.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.example.springcloud.entity.Dept;
import com.example.springcloud.service.DeptService;

@RestController
public class DeptController {

	@Autowired
	private DeptService deptService;
	
	@PostMapping("dept/add")
	public boolean add(@RequestBody Dept dept) {
		// TODO Auto-generated method stub
		return deptService.add(dept);
	}

	@GetMapping("dept/get/{deptno}")
	public Dept get(@PathVariable("deptno") Long deptno) {
		// TODO Auto-generated method stub
		return deptService.get(deptno);
	}

	@GetMapping("dept/list")
	public List<Dept> list() {
		// TODO Auto-generated method stub
		return deptService.list();
	}
}
